cmake_minimum_required(VERSION 3.5)
project(ndt_localizer)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
  set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find_package(ament_cmake_auto REQUIRED
#         rclcpp
#         tf2
#         tf2_ros
#         tf2_geometry_msgs
#         std_msgs
#         geometry_msgs
#         sensor_msgs
#         nav_msgs
#         diagnostic_msgs
#         pcl_conversions
#         pcl_ros
#         message_generation
#         )

# generate_messages(
#         DEPENDENCIES
#         std_msgs
# )

find_package(PCL REQUIRED QUIET)
find_package(ament_cmake_auto REQUIRED)
find_package(Eigen3 REQUIRED)
ament_auto_find_build_dependencies()

# include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(include
)

###########
## Build ##
###########

# include_directories(include ${catkin_INCLUDE_DIRS})
# SET(CMAKE_CXX_FLAGS "-O2 -g -Wall ${CMAKE_CXX_FLAGS}")
include_directories(include
)

ament_auto_add_executable(voxel_grid_filter nodes/points_downsampler.cpp)

ament_auto_add_executable(map_loader nodes/map_loader.cpp)

ament_auto_add_executable(ndt_localizer_node nodes/ndt.cpp)

if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
  target_compile_definitions(ndt_localizer_node PUBLIC
    USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
  )
endif()

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()
ament_auto_package(INSTALL_TO_SHARE launch rviz map cfgs)